#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import "MRViewController.h"

@class MRQRCode;
typedef void(^QRCodeHandler)(MRQRCode *viewController, AVMetadataMachineReadableCodeObject *codeObject);

@interface MRQRCode : MRViewController <AVCaptureMetadataOutputObjectsDelegate>
{
	QRCodeHandler				_handler;
	
	AVCaptureDevice             *_device;
	AVCaptureDeviceInput        *_input;
	AVCaptureMetadataOutput     *_output;
	AVCaptureSession            *_session;
	AVCaptureVideoPreviewLayer  *_preview;
	
	UIImageView					*_lineView;
}

+ (id)qrcodeWithHandler:(QRCodeHandler)handler;

@property (nonatomic, readonly) UIView	*userView;
@property (nonatomic) UIBezierPath		*path;

- (void)startScan;		//启动后自动开始扫描
- (void)stopScan;

@end
